package com.zhongyu.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
/*
@Configuration
public class MailUtil {
    private JavaMailSender javaMailSender;
    public void setJavaMailSender(JavaMailSender javaMailSender) {
        this.javaMailSender = javaMailSender;
    }
    private String fromAddress;
    public void setFromAddress(String fromAddress) {
        this.fromAddress = fromAddress;
    }
    public void sendMail(String toAddress,String subject,String text) throws MessagingException {
        MimeMessage mime = javaMailSender.createMimeMessage();
        MimeMessageHelper helper=new MimeMessageHelper(mime);
        helper.setSubject(subject);
        helper.setFrom(fromAddress);
        helper.setTo(toAddress);
        helper.setText(text);
        javaMailSender.send(mime);
    }

}*/
